require 'sm'
class ServersController < ApplicationController
  before_filter :authorize
  before_filter :second

  before_filter :find_instances, :only => [:index]

  def index
    if params[:project_id] == nil
      flash.now[:error] = [t(:error), t(:please_choose_a_project)]
    end
    #tt = CloudSetting.configs['server_manager']['url']
    #tt = SM::service.server_manager
  end

  def new
  end

  private
  def second
    logger.error('i am called')
  end

  def find_instances
    @instances = nil 
    @instances = SM::do.call :get_instances_by_app, params[:project_id] if params[:project_id]
  end
end
